<?php
/**
 * Author: Administrator
 * Date: 2022/7/24 16:59
 */

namespace DesignPatterns\Behavioral\Mediator;


class Mediator implements MediatorInterface
{

    protected $client;
    protected $db;
    protected $server;

    public function setColleague($client, $db, $server)
    {
        $this->client = $client;
        $this->server = $server;
        $this->db = $db;
    }

    public function sendResponse($response)
    {
        return $this->client->output($response);
    }

    public function queryDB($sql)
    {
        return $this->db->query($sql);
    }

    public function handleRequest($data)
    {
        $this->server->handle($data);
    }
}